package com.zhuliyou.ai.config;


import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 自定义配置
 *
 * @author zhuliyou
 * @date 2021/06/02
 */
@Component
@ConfigurationProperties("custom-config")
@Data
public class CustomConfig {
    private String clientId;
    private String clientSecret;
    private String authHost;
    private String url;
    private String imgType;

    public List<String> getImgType() {
        List<String> ret = new ArrayList<>();
        if (this.imgType.contains(",")) {
            String[] split = this.imgType.split(",");
            ret.addAll(Arrays.asList(split));
        } else {
            ret.add(this.imgType);
        }
        return ret;
    }
}
